package main

import (
	"flag"
	"fyne.io/fyne/v2/app"
	"gitee.com/andrewgithub/EtcdKeeperFyne/keepertheme"
	"gitee.com/andrewgithub/EtcdKeeperFyne/resources"
	window "gitee.com/andrewgithub/EtcdKeeperFyne/window"
	"github.com/golang/glog"
)

// 创建一个Etcd管理的App's
func main() {
	flag.Parse()
	// 最后将日志进行更新
	defer glog.Flush()
	// 构造界面
	keeperEdit := &window.KeeperEdit{
		App: app.NewWithID("keeper edit"),
	}
	// 设置程序图标
	keeperEdit.App.SetIcon(resources.KeeperShotIconPng)
	keeperEdit.App.Settings().SetTheme(&keepertheme.Fzltch{RefThemeApp: keeperEdit.App,
		FontSizeName: "KeeperEtcdTheme"})

	keeperEdit.Win = keeperEdit.App.NewWindow("Keeper Edit")

	// 创建命令行菜单
	keeperEdit.Win.SetMainMenu(keeperEdit.MakeNewMenu())
	// 注册快捷键
	keeperEdit.RegisterShortcuts()

	data := window.EmptyData()
	keeperEdit.Tasks = &window.TaskApp{Ke: keeperEdit,
		TaskData:     data,
		Visible:      data.Remaining(),
		LeaseVisible: data.Remaining()}

	keeperEdit.Win.SetContent(keeperEdit.Tasks.MakeUI())

	keeperEdit.Win.ShowAndRun()
}
